
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>CCCCCCCCCCCCCCCCCCCCCCCCCCCCC</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="https://static.9hive.cn/global/css/bootstrap-extend.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.css?v=1.1">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/mmenu/assets/css/site.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/fonts/font-awesome/font-awesome.min.css">
    <link href="https://static.9hive.cn/global/vendor/icheck/icheck.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/icheck/skins/flat/blue.css" rel="stylesheet">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/nprogress/nprogress.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/multi-select/multi-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/inside/inside.css?v=1">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/common/common_20170925.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/file/file.css" >
    <link rel="stylesheet" href="https://static.9hive.cn/global/iconhive/hiveicon.css">

    <!--[if lt IE 9]>
    <script src="https://static.9hive.cn/global/vendor/html5shiv/html5shiv.min.js"></script>
    <![endif]-->

    <!--[if lt IE 10]>
    <script src="https://static.9hive.cn/global/vendor/media-match/media.match.min.js"></script>
    <script src="https://static.9hive.cn/global/vendor/respond/respond.min.js?v=1.2.1"></script>
    <![endif]-->

</head>

<body>
<div class="background-white">
    <div class="">
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <div  id="toolbar" class="form-inline">
                        <button style="display: none;" type="button" id="button" class="btn btn-outline btn-default">
                            <i class="glyphicon" aria-hidden="true"></i>选择
                        </button>
                        <!--<div class="btn-group hidden-lg" role="group">
                            <select name="location_p" class="form-control light-input" id="location_p"></select>
                        </div>
                        <div class="btn-group hidden-lg" role="group">
                            <select name="location_c" class="form-control light-input" id="location_c"></select>
                        </div>
                        <div class="btn-group hidden-lg" role="group">
                            <select name="location_a" class="form-control light-input" id="location_a"></select>
                        </div>-->

                       <!-- <button type="button" id="checkButton" class="hive-btn  hive-btn-primary">
                            <i class="glyphicon" aria-hidden="true"></i>查询
                        </button>-->
                    </div>
                    <input type="hidden" id="rowId">
                    <table id="_table" class="table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                        <thead class="table-head" style="display:table-caption;">
                        <tr>
                          <th data-field="state" data-checkbox="true" data-width="10%" data-formatter="selectFortter"  ></th>
                            <!--<th data-field="id" data-width="17.2%">用户编号</th>-->
                            <th data-field="username" data-formatter="lbusinessFormatter" data-width="45%">用户名称</th>
                         <!--   <th data-field="" data-width="30%" data-formatter="locationFormatter">用户地址</th>-->
                            <th data-field="phone" data-width="45%">联系电话</th>
                        </tr>
                        </thead>
                        <tbody class="table-head" style="display:table-caption; max-height:400px;overflow-y: scroll;"></tbody>
                    </table>
                    <div style="margin-top: -70px">共<span id="sudata">0</span>数据，已选<span id="ischeck">0</span>条数据</div>
                </div>
            </div>
        </div>
    </div>
</div>



<script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-export/bootstrap-export.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-export/jquery-export.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/multi-select/jquery.multi-select.js"></script>
<script src="https://static.9hive.cn/global/js/core.min.js"></script>
<script src="https://static.9hive.cn/mmenu/assets/js/site.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
<script src="https://static.9hive.cn/global/vendor/icheck/icheck.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/nprogress/nprogress.js"></script>
<!--<script src="https://static.9hive.cn/global/js/components/bootstrap-select.min.js"></script>-->
<!--<script src="https://static.9hive.cn/global/js/components/multi-select.min.js"></script>-->

<script src="https://static.9hive.cn/global/vendor/layer/laydate/laydate.js">

</script>

<script src="https://static.9hive.cn/global/vendor/jquery-validate/jquery.validate.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/additional-methods.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/localization/messages_zh.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ajaxform/ajax-form.js"></script>
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script type="text/javascript" src="https://static.9hive.cn/global/vendor/file/uploadify/ajaxfileupload.js" ></script>
<script type="text/javascript">
    var uploadUrl = "/card/file/uploadfile?shopId=4da05513b44a4762849c3fe32f792aa8&type=d";
    var browserUrl = "/card/file/browser?shopId=4da05513b44a4762849c3fe32f792aa8";
</script>
<script src="https://static.9hive.cn/global/vendor/file/file.js"></script>

<script src="https://static.9hive.cn/global/vendor/city-pick/region_select.js"></script>
<!--<script type="text/javascript">
    new PCAS('location_p', 'location_c', 'location_a', '北京市', '市辖区', '东城区');
</script>-->
<script>
    function refresh_table() {
        $('#_table').bootstrapTable('refresh');
    }
    function lbusinessFormatter(value, row,index) {
        var _statusString=value;
        if(value.length>10){
            _statusString=_statusString.substring(0,10)+". . .";
        }
        var html='<span data-toggle="tooltip" data-placement="top" title="'+value+'">'+_statusString+'</span>';
        return html;
    }
    function locationFormatter(value, row,index) {
        var province = row.province;
        var city = row.city;
        var district = row.district;
        var address = row.address;
        var statusString = province + city + district + address;
        var _statusString=statusString;
        if(statusString.length>13){
            _statusString=statusString.substring(0,13)+". . .";
        }
        var html='<span data-toggle="tooltip" data-placement="top" title="'+statusString+'">'+_statusString+'</span>';
        return html;
    }
   var iframeWin=window.parent.document.getElementById("mainFrame");
    console.log(iframeWin);
    var Win = iframeWin.contentWindow;
    var store_ids =Win.storeIds;
    function selectFortter(v, row) {
        var boo = false;
        $(store_ids).each(function (index, dom) {
            if (dom== row.id) {
                boo = true;
                return true;
            }
        });
        if (boo) {
            return {
                // disabled : true,//设置是否可用
                checked: true//设置选中
            }
        }
    }
    var index = parent.layer.getFrameIndex(window.name);

    (function () {
        $('#_table').bootstrapTable({
            url: "/mall/admin/SmsController/getListUserData",
//            pagination: true,
            //onlyInfoPagination: true,
            clickToSelect: true,
            maintainSelected:true,
            search: true,
            showRefresh: true,
            iconSize: 'outline',
            toolbar: '#toolbar',
            uniqueId: "id",
            pageSize:10,
            align:"center",
            formatNoMatches: function () {     var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';     return imghtml; },
            formatLoadingMessage: function () {  //数据加载中样式
                return ' <div id="loading"><div id="loading-center">' +
                    '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                    '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                    '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
            },
            icons: {
                refresh: 'icon-refresh',
                toggle: 'glyphicon-list-alt',
                columns: 'icon-select',
                export: 'icon-export'
            },
            formatSearch: function () {
                return '输入用户名称或电话号';
            },
            onSearch:function (text) {

            },
            onAll:function () {
                var sele=$("#_table").bootstrapTable("getData");
                $("#sudata").text(sele.length)
                var selections=$("#_table").bootstrapTable("getSelections");
                $("#ischeck").text(selections.length)
            },
        });
        $(".wrapper").tooltip({selector:"[data-toggle=tooltip]",container:"body"});
        $('#button').on('click', function (e) {
            var jsonPois =$('#_table').bootstrapTable('getSelections');
            var added=[];
            $.each (jsonPois,function(i,item){
                var boo = true;
                $(store_ids).each(function (index, dom) {
                    if (dom== jsonPois[i].id) {
                        boo = false;
                        return false;
                    }
                });
                if (boo) {
                    added.push(item);
                    Win.addstoreId(jsonPois[i].id)
                }
            });
            window.parent._send("method", "", added)
            parent.layer.close(index);
        });
        $(".row").tooltip({selector: "[data-toggle=tooltip]", container: "body"});
    })();
</script>
<script>
    $("#checkButton").on('click', function () {
//        alert(124);
        var province = $("#location_p").val();
        var city = $("#location_c").val();
        var district = $("#location_a").val();
//        var url = "getAllPois?province="+province+"&city="+city+"&district="+district;
//        var opt = {
//            url: url,
//            silent: true
//        };

        $('#_table').bootstrapTable('refresh', {query: {province: province, city: city, district: district}});
    });


</script>
</body>

</html>
<style>
    .table-head tr{
        width: 100%; display: table;
    }
    .th-inner{
        text-align: center!important;
    }
    td{
        text-align: center!important;
    }
</style>

